# 指定基础镜像
FROM ubuntu:20.04
# 配置环境变量，JDK的安装目录
ENV JAVA_DIR=/usr/local

# 拷贝jdk和java项目的包
COPY ./jdk-11.0.13_linux-x64_bin.tar.gz $JAVA_DIR/
COPY ./gulimall-search-1.0.jar /user/app/
COPY ./gateway-1.0.jar /user/app/
COPY ./gulimall-member-1.0.jar /user/app/
COPY ./gulimall-ware-1.0.jar /user/app/
COPY ./gulimall-product-1.0.jar /user/app/

# 安装JDK
RUN cd $JAVA_DIR \
 && tar -xf ./jdk-11.0.13_linux-x64_bin.tar.gz \
 && mv ./jdk-11.0.13 ./java11

# 配置环境变量
ENV JAVA_HOME=$JAVA_DIR/java11
ENV PATH=$PATH:$JAVA_HOME/bin

#统一时间
ENV TZ=Asia/Shanghai
RUN ln -sf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

WORKDIR /user/app

CMD java -Xms128m -Xmx512m -jar gulimall-search-1.0.jar & \
    java -Xms128m -Xmx512m -jar gateway-1.0.jar & \
    java -Xms128m -Xmx512m -jar gulimall-member-1.0.jar & \
    java -Xms128m -Xmx512m -jar gulimall-ware-1.0.jar & \
    java -Xms128m -Xmx512m -jar gulimall-product-1.0.jar

# 暴露端口
EXPOSE 10100